<template>
	<view>
		<view class="list">
			<view class="item">
				<text>User Photo</text>
				<image :src="infoList.avatar" mode=""></image>
			</view>
			<view class="item">
				<text>User Name</text>
				<text>{{infoList.nickname}}</text>
			</view>
			<view class="item" @click="Logout">
				<view>MUSE platform</view>
				<view>
					<u-button type="error" shape="circle" size="mini" :text="text"></u-button>
				</view>
			</view>
		</view>
		<u-modal :show="show" :confirmText="confirmText" :cancelText="cancelText" :title="title" @confirm="confirm" @cancel="cancel" :showCancelButton="true" :content='content'></u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infoList: [],
				show:false,
				text:this.$t('user.Exit'),
				title:this.$t('user.prompt'),
				content:this.$t('user.Logout'),
				cancelText:this.$t('user.cancel'),
				confirmText:this.$t('user.yes')
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				const params = {
					map: 'applet_member_info'
				}
				this.$Request({
					method: 'GET',
					data: params
				}).then(res => {
					if (res.data.ec == 200) {
						console.log(res)
						this.infoList = res.data.data
					} else {

					}
				})
			},
			cancel(){
				this.show = false
			},
			Logout() {
				this.show = true
			},
			confirm(){
				uni.clearStorageSync();
				this._i18n.locale = 'en';
				uni.setStorageSync('lang', 'en');
				uni.reLaunch({
					url:'/pages/login/login'
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f4f5f6;
		font-size: 28rpx;
		color: #333333;
		border-top: 1px solid #f4f5f6;
	}

	.list {
		.item {
			margin: 20rpx 20rpx 0 20rpx;
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
			border-radius: 50rpx;
			background-color: #FFFFFF;

			image {
				width: 42rpx;
				height: 42rpx;
				border-radius: 100%;
			}

			.zhi {
				color: #737373;
				font-size: 32rpx;
			}
		}
	}

	.confirmed {
		color: #f4f5f6;
		position: fixed;
		bottom: 0;
		width: 100%;
		background-color: #FFFFFF;
		padding: 30rpx 0;

		view {
			padding: 26rpx 0;
			background-color: #2497ff;
			width: 70%;
			border-radius: 50rpx;
		}
	}
</style>
